package com.placement.refresh.model;

import org.rssowl.core.internal.persist.Description;
import org.rssowl.core.internal.persist.News;

public class MonsterJob extends AbstractJob {

	public void parseJobData(News news, Description desc) {
		System.out.println(desc.getValue());
		this.setId(news.getId());
		this.setTitle(news.getfTitle());
		this.setDescription(desc.getValue());
		this.setLink(news.getLinkAsText());
		if(desc.getValue().length()>0 && desc.getValue().indexOf(",") != -1){
			String location = desc.getValue().substring(0, desc.getValue().indexOf(","));
			String state = "";
			String city="";
			if(location.length()>4){
				state = location.substring(0,2);
				city = location.substring(3,location.length()).toUpperCase();
			}
			this.setState(state);
			this.setCity(city);
		}
		if(desc.getValue().length()>0 && desc.getValue().indexOf(",") != -1)
			this.setDescription(desc.getValue().substring((desc.getValue().indexOf(",") + 2), desc.getValue().length()));
	}

	public String getCompanyName() {
		return "Monster";
	}
	
	public Long getCompanyId(){
		return new Long(1L);
	}

}
